package com.lh.mybatisuse;

import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;

import java.net.InetAddress;
import java.net.UnknownHostException;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
public class LhApplication {
    public static void main(String[] args) throws UnknownHostException {
        final ConfigurableApplicationContext run = new SpringApplicationBuilder(LhApplication.class)
                .web(WebApplicationType.SERVLET)
                .run(args);
        final String port = run.getEnvironment().getProperty("server.port");
        InetAddress localHost = InetAddress.getLocalHost();
        final String hostAddress = localHost.getHostAddress();
        System.out.println(String.format("http://%s:%s/swagger-ui.html", hostAddress, port));
    }
}
